#!/usr/bin/env python
# coding=utf-8

import time
import random

def message():
    print("There are two dragon")
    print("One is evil,you will be eat!")
    print("The other is friend,you will receive treasure")
    print("Now you can choose")

def choose():
    print("Now you can choose ")
    cave = ' '
    while cave != '1' or cave != '2':
        print("1 or 2")
        cave = input()
        return cave

def dragon():
    print('You approach the cave...')
    time.sleep(2)
    print('It is dark and spooky...')
    time.sleep(2)
    print('A large dragon jumps out in front of you! He opens his jaws and...')
    print()
    time.sleep(2)

def judge(cave):
    number = random.randint(1,2)
    if cave == str(number):
        print("You win")
    else:
        print("You died")


start = 'yes'
while start == 'yes' or start == 'y':
    message()
    dragon()
    cave = choose()
    judge(cave)
    print("Would you want to play again? (yes or no)")
    start = input()


